package com.imc.platform.base.schedule.service;

import com.alibaba.fastjson.JSON;
import com.imc.api.order.dao.IOrderMapper;
import com.imc.api.order.repository.IApiLessonMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by tanweiping on 2018/12/3.
 */
@Service
@Transactional
@Slf4j
public class ResumeService {

    @Autowired
    IOrderMapper iOrderMapper;

    /*
    * tanweiping  2018/12/3 17:34
    * 方法描述：回收库存
    */
    public void resumeStockFromOrder(){
        log.info("查询需要恢复的库存数据");
        List<Map<String,Object>> data = iOrderMapper.queryResumeStock();
        log.info("需要恢复的库存"+ JSON.toJSONString(data));
        iOrderMapper.resumeStock(data);
        log.info("库存恢复成功");
    }
}
